ChooseButton();
var currentcarid = tempid;

$.ajax({
    type: "get",
    url : "packet/"+currentcarid,
    data: {meterId:"meterId"},
    dataType: "json",
    success: function(data){
        if(data){
            datarequired = [];
            for(var i = data.length-1 ; i >=0; i--){
                datarequired.push(data[i]);
            }
            showChart1();
            showChart2();
            showChart3();
            showChart4();
            eneryChart();
            showChart();
        }
    },
    error: function(errmsg) {
        alert("Ajax获取服务器数据出错了！"+ errmsg);
    }
});

var t=window.setInterval(getusers, 10000);
var datarequired = new Array();

function getusers() {
    $.ajax({
        type: "get",
        url : "packet/"+currentcarid,
        data: {meterId:"meterId"},
        dataType: "json",
        success: function(data){
            if(data){
                datarequired = [];
                for(var i = data.length-1 ; i >=0; i--){
                    datarequired.push(data[i]);
                }
            }
            showChart1();
            showChart2();
            showChart3();
            showChart4();
            eneryChart();
            showChart();
        },
        error: function(errmsg) {
            alert("Ajax获取服务器数据出错了！"+ errmsg);
        }
    });
}